{#
    The standard package navigation menu

    * `metadata` A non-null instance of the MetaData struct
    * `active_tab` A string with one of the following values:
        * `crate`
        * `source`
        * `builds`
        * `features`

    Note: `false` here is acting as a pseudo-null value since you can't directly construct null values
           and tera requires all parameters without defaults to be filled
#}
{% macro package_navigation(metadata, active_tab) %}
    <div class="docsrs-package-container">
        <div class="container">
            <div class="description-container">
                {# The partial path of the crate, `:name/:release` #}
                {%- set crate_path = "{}/{}"|format(metadata.name, metadata.req_version) -%}

                {# If docs are built, show a button for them #}

                {# Page title #}
                <h1 id="crate-title">
                    {{ metadata.name }} {{ metadata.version }}
                    <span id="clipboard" class="svg-clipboard" title="Copy crate name and version information"></span>
                </h1>

                {# Page description #}
                <div class="description">
                    {%- if let Some(description) = metadata.description -%}
                        {{ description }}
                    {%- endif -%}
                </div>


                <div class="pure-menu pure-menu-horizontal">
                    <ul class="pure-menu-list">
                        {# The crate information tab #}
                        <li class="pure-menu-item"><a href="{{ params.crate_details_url() }}"
                                class="pure-menu-link{% if active_tab == &"crate" %} pure-menu-active{% endif %}">
                                {{ crate::icons::IconCube.render_solid(false, false, "") }}
                                <span class="title"> Crate</span>
                            </a>
                        </li>

                        {# The source view tab #}
                        <li class="pure-menu-item">
                            <a href="{{ params.source_url() }}"
                                class="pure-menu-link{% if active_tab == &"source" %} pure-menu-active{% endif %}">
                                {{ crate::icons::IconFolderOpen.render_regular(false, false, "") }}
                                <span class="title"> Source</span>
                            </a>
                        </li>

                        {# The builds tab #}
                        <li class="pure-menu-item">
                            <a href="{{ params.builds_url() }}"
                                class="pure-menu-link{% if active_tab == &"builds" %} pure-menu-active{% endif %}">
                                {{ crate::icons::IconGears.render_solid(false, false, "") }}
                                <span class="title"> Builds</span>
                            </a>
                        </li>

                        {# The features tab #}
                        <li class="pure-menu-item">
                            <a href="{{ params.features_url() }}"
                               class="pure-menu-link{% if active_tab == &"features" %} pure-menu-active{% endif %}">
                                {{ crate::icons::IconFlag.render_solid(false, false, "") }}
                                <span class="title">Feature flags</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>

            {%- if metadata.rustdoc_status.unwrap_or_default() -%}
                <a href="{{ params.rustdoc_url()}}" class="doc-link">
                    {{ crate::icons::IconBook.render_solid(false, false, "") }} Documentation
                </a>
            {%- endif -%}
        </div>
    </div>
{% endmacro package_navigation %}
